package main
import "fmt"

type Person interface {
	eat()
	sleep()
}

type Student struct {
	Name string
	Age int
	Grade string
}

func (s Student) eat() {
	fmt.Println("Student eat")
}

func (s Student) sleep() {
	fmt.Println("Student sleep")
}

type Teacher struct {
	Name string
	Subject string
	Class string
}

func (t Teacher) eat() {
	fmt.Println("Teacher eat")
}

func (t Teacher) sleep() {
	fmt.Println("Teacher sleep")
}

func main() {
	var student1 Person = Student{
		Name: "student1",
		Age: 18,
		Grade: "grade1",
	}
	var teacher1 Person = Teacher{
		Name: "teacher1",
		Subject: "math",
		Class: "class1",
	}

	student1.eat()
	student1.sleep()
	teacher1.eat()
	teacher1.sleep()

	var _, isStudent = student1.(Student)
	fmt.Printf("student1的类型是Student吗？%v\n", isStudent)
	var _, isTeacher = teacher1.(Teacher)
	fmt.Printf("teacher1的类型是Teacher吗？%v\n", isTeacher)

}